<?php
/*
 * This file is part of the BooXtore Student project.
 *
 * (c) Francis Backeland f.backeland@gmail.com
 * (c) Laurine Chaplot chaplot.laurine@orange.fr
 * (c) Julien Dutot julien.dutot@gmail.com
 * (c) Romain Guillaume romain-guillaume@orange.fr
 * (c) Guillaume Paringaux g.paringaux@gmail.com
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code
 */

namespace BXTR\AdminBundle\Form\Type;

use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use BXTR\DatatablesBundle\Form\Type\DatatablesSelectorType;
/** 
 * Extension of datatables_selector, displaying a list of provided categories inside a datatables 
 * HTML table.
 * Field : 
 * * Name
 * * # of Books
 */
class BookCategoryListType extends AbstractType
{
    public function getParent()
    {
        return 'datatables_selector';
    }

    public function getName()
    {
        return 'category_list';
    }

    /**
     * Define the displayed fields, the index identifier and the labels used
     * by the form table.
     *
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'fields' => Array('name', 'booksCount'),
            'labels' => Array('Ent.Default.Fields.Name', 'Ent.BookCategory.Fields.booksCount'),
            'index_field' => 'id'
        ));
    }
};
